package com.epcs.model.bo;

import java.util.ArrayList;
import java.util.List;

import com.epcs.model.dao.EventCategoryDAO;
import com.epcs.model.dao.EventDAO;
import com.epcs.model.dao.FollowingDAO;
import com.epcs.model.dto.Account;
import com.epcs.model.dto.Event;
import com.epcs.model.dto.Eventcategory;
import com.epcs.model.dto.MostFollowingList;
import com.epcs.util.EpcsDateTimeUtil;

public class EventcategoryBO {

    public Eventcategory getCategoryByID(String categoryID) {
	Integer categoryIDInt = Integer.parseInt(categoryID);
	
	EventCategoryDAO dao = new EventCategoryDAO();
	Eventcategory category = dao.getEventCategoryByID(categoryIDInt);
		
	return category;
    }

    public List<Eventcategory> getAllEventCategory(boolean includeDeactiveItems){
    	
    	List<Eventcategory> allEventCat = new ArrayList<Eventcategory>();
		EventCategoryDAO dao = new EventCategoryDAO();
		allEventCat = dao.getAllEventcategories(includeDeactiveItems);
		return allEventCat;
    }
    
    public List<Eventcategory> getAllFollowedCategory(Account account){
    	List<Eventcategory> userCategoryList = null;
    	
    	FollowingDAO followDAO = new FollowingDAO();
    	EventCategoryDAO eventCategoryDAO =  new EventCategoryDAO();
    	List<Integer> listCategoryId = followDAO.getCategoryIdListByAccount(account);
		userCategoryList = eventCategoryDAO.getEventCategoryListByCategoryIdList(listCategoryId);		
		
    	return userCategoryList;
    }
    
    public List<Integer> getAllFollowedCategoryID(Account account){
    	List<Integer> categoryIDList = null;
    	
    	FollowingDAO followDAO = new FollowingDAO();
    	EventCategoryDAO eventCategoryDAO =  new EventCategoryDAO();
    	categoryIDList = followDAO.getCategoryIdListByAccount(account);	
    	
    	return categoryIDList;
    }
    
    public List<Integer> getAllFollowedCategoryIDFromSystem(){
    	List<Integer> categoryIDList = null;
    	
    	FollowingDAO followDAO = new FollowingDAO();
    	EventCategoryDAO eventCategoryDAO =  new EventCategoryDAO();
    	categoryIDList = followDAO.getFollowedCategoryIdListFromSystem();	
    	
    	return categoryIDList;
    }
    
    public Eventcategory getCatByID(Integer catId) {
		Eventcategory catDetail = new Eventcategory();
		EventCategoryDAO dao = new EventCategoryDAO();
		catDetail = dao.getEventCategoryByID(catId);
		return catDetail;
	}
    public Eventcategory getEventCategory(String NameAjax){
    	EventCategoryDAO dao = new EventCategoryDAO();
    	return dao.getEventCategory(NameAjax);
    }
    public boolean insertCategoryName(Eventcategory category){
    	EventCategoryDAO dao = new EventCategoryDAO();
    	return dao.insertCategoryToDB(category);
    }
    public boolean updateCategory(Eventcategory category){
    	EventCategoryDAO dao = new EventCategoryDAO();
    	return dao.updateCategory(category);
    }
    public List<MostFollowingList> getAllFollowingCategory(){
    	EventCategoryDAO dao = new EventCategoryDAO();
    	return dao.getAllFollowingCategory();
    }
}


